﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Annexe.aspx.cs" Inherits="Jy123.Web.Manage.Annexe" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理赛车</title>
    <link href="css/custom/jquery.ui.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery.js" type="text/javascript"></script>

    <script src="js/jquery.ui.js" type="text/javascript"></script>

    <script src="js/main.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        function Validate(){ 
        var fileUploadSmall=document.getElementById('<%=fileUploadSmall.ClientID %>');
        var fileUploadBig=document.getElementById('<%=fileUploadBig.ClientID %>');
        var actionHidden=document.getElementById('<%=actionTypeHidden.ClientID %>');
        var button=document.getElementById('<%=SaveButton.ClientID %>');
        button.disabled=""; 
        var fileName;
        var index;
        var length;
        var fileType;       
        if(fileUploadSmall.value==''){        
            if(actionHidden.value=='Add'){
                $("#noSmallLogoSpan").css('display','block');
                $("#errorSmallLogoSpan").css('display','none');
                button.disabled="disabled";                
            }
        }else{
            $("#noSmallLogoSpan").css('display','none');
            fileName=fileUploadSmall.value;
            index=fileName.lastIndexOf(".")+1;
            length=fileName.length-fileName.lastIndexOf(".")-1;                                                  
            fileType=fileName.substr(index,length);           
           if(fileType=='jpg'||fileType=='gif'||fileType=='tiff'||fileType=='jpeg'||fileType=='png'||fileType=='bmp'){
                $("#errorSmallLogoSpan").css('display','none');
                $("#annexeSmallImage").attr("src",fileUploadSmall.value);       
           }else{
                $("#errorSmallLogoSpan").css('display','block');
                button.disabled="disabled";                 
           }          
        }
        
        if(fileUploadBig.value==''){        
            if(actionHidden.value=='Add'){
                $("#noBigLogoSpan").css('display','block');
                $("#errorBigLogoSpan").css('display','none');
                button.disabled="disabled";                
            }
        }else{
            $("#noBigLogoSpan").css('display','none');
            fileName=fileUploadBig.value;
            index=fileName.lastIndexOf(".")+1;
            length=fileName.length-fileName.lastIndexOf(".")-1;                                                  
            fileType=fileName.substr(index,length);           
           if(fileType=='jpg'||fileType=='gif'||fileType=='tiff'||fileType=='jpeg'||fileType=='png'||fileType=='bmp'){
                $("#errorBigLogoSpan").css('display','none');
                $("#annexeBigImage").attr("src",fileUploadBig.value)            
           }else{
                $("#errorBigLogoSpan").css('display','block');
                button.disabled="disabled";                 
           }          
        }
      }
	$(function() {
		$("#earningsDiv").slider({range: "min",value:1,min: 1,max: 50000,
			slide: function(event, ui) {
				$("#earningsTextBox").val( ui.value);
			}
		});
		$("#raceEarningsDiv").slider({range: "min",value:1,min: 1,max: 100000,
			slide: function(event, ui) {
				$("#raceEarningsTextBox").val( ui.value);
			}
		});
		$("#xDiv").slider({range: "min",value:0,min: 0,max: 800,
			slide: function(event, ui) {
				$("#xTextBox").val( ui.value);
			}
		});
		$("#yDiv").slider({range: "min",value:0,min: 0,max: 500,
			slide: function(event, ui) {
				$("#yTextBox").val( ui.value);
			}
		});
		$("#priceDiv").slider({range: "min",value:1,min: 1,max: 1000000,
			slide: function(event, ui) {
				$("#priceTextBox").val( ui.value);
			}
		});
	});
    </script>

    <style type="text/css">
        .carimg
        {
            border: 3px solid #CECABC;
            padding: 2px;
            width: 150px;
            height: 101px;
            margin-left: 70px;
            margin-bottom: 15px;
        }
    </style>
</head>
<body>
    <h4>
        <a href="#"><span>设施管理</span></a></h4>
    <form id="manageJTypeForm" runat="server">
    <div class="register">
        <ul>
            <li class="w85r b">适用组件类型 </li>
            <li>
                <asp:DropDownList ID="JTypeDropDown" runat="server" OnSelectedIndexChanged="JTypeDropDown_Change"
                    AutoPostBack="true">
                </asp:DropDownList>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="JTypeNameRequired" CssClass="warning" runat="server"
                    ControlToValidate="JTypeDropDown" ErrorMessage="请选择组件类型" Display="Dynamic" ForeColor=""
                    InitialValue="-1"></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">设施类型 </li>
            <li>
                <asp:DropDownList ID="ATypeDropDown" runat="server" OnSelectedIndexChanged="ATypeDropDown_Change"
                    AutoPostBack="true">
                </asp:DropDownList>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" CssClass="warning" runat="server"
                    ControlToValidate="ATypeDropDown" ErrorMessage="请选择设施类型" Display="Dynamic" ForeColor=""
                    InitialValue="-1"></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">设施名称 </li>
            <li>
                <asp:TextBox ID="annexeNameTextBox" runat="server" MaxLength="20" CssClass="text"
                    onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="annexeNameRequired" CssClass="warning" runat="server"
                    ControlToValidate="annexeNameTextBox" ErrorMessage="请填写设施名称" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul id="earningUl" runat="server">
            <li class="w85r b">普通比赛收入 </li>
            <li>
                <asp:TextBox ID="earningsTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="annexeLevelRequired" CssClass="warning" runat="server"
                    ControlToValidate="earningsTextBox" ErrorMessage="请填写普通比赛收入" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
            <li>
                <div id="earningsDiv" class="slider">
                    <ul>
                    </ul>
                </div>
            </li>
            <li>
                <asp:RangeValidator ID="annexeLevelRange" CssClass="warning" runat="server" ControlToValidate="earningsTextBox"
                    ErrorMessage="请填写1－50000之间的整数" Type="Integer" MinimumValue="1" MaximumValue="50000"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul id="raceEarningUl" runat="server">
            <li class="w85r b">大型比赛收入 </li>
            <li>
                <asp:TextBox ID="raceEarningsTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" CssClass="warning" runat="server"
                    ControlToValidate="raceEarningsTextBox" ErrorMessage="请填写大型比赛收入" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
            <li>
                <div id="raceEarningsDiv" class="slider">
                    <ul>
                    </ul>
                </div>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator3" CssClass="warning" runat="server" ControlToValidate="raceEarningsTextBox"
                    ErrorMessage="请填写1－100000之间的整数" Type="Integer" MinimumValue="1" MaximumValue="100000"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">X轴位置 </li>
            <li>
                <asp:TextBox ID="xTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" CssClass="warning" runat="server"
                    ControlToValidate="xTextBox" ErrorMessage="请填写X轴位置" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
            <li>
                <div id="xDiv" class="slider">
                    <ul>
                    </ul>
                </div>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator4" CssClass="warning" runat="server" ControlToValidate="xTextBox"
                    ErrorMessage="请填写0－800之间的整数" Type="Integer" MinimumValue="0" MaximumValue="800"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">Y轴位置 </li>
            <li>
                <asp:TextBox ID="yTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" CssClass="warning" runat="server"
                    ControlToValidate="yTextBox" ErrorMessage="请填写Y轴位置" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
            <li>
                <div id="yDiv" class="slider">
                    <ul>
                    </ul>
                </div>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator5" CssClass="warning" runat="server" ControlToValidate="yTextBox"
                    ErrorMessage="请填写0－600之间的整数" Type="Integer" MinimumValue="0" MaximumValue="600"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul>
            <li class="w85r b">设施小图标 </li>
            <li>
                <asp:FileUpload ID="fileUploadSmall" runat="server" CssClass="text" onchange="Validate()" />
            </li>
            <li>
                <img id="annexeSmallImage" runat="server" alt="" src="" class="carimg" />
            </li>
            <li><span id="noSmallLogoSpan" class="warning1" style="display: none">请上传一张图片</span>
                <span id="errorSmallLogoSpan" class="warning1" style="display: none">请选择正确的图片格式</span></li>
        </ul>
        <ul>
            <li class="w85r b">设施大图标 </li>
            <li>
                <asp:FileUpload ID="fileUploadBig" runat="server" CssClass="text" onchange="Validate()" /></li>
            <li>
                <img id="annexeBigImage" runat="server" alt="" src="" class="carimg" />
            </li>
            <li><span id="noBigLogoSpan" class="warning1" style="display: none">请上传一张图片</span> <span
                id="errorBigLogoSpan" class="warning1" style="display: none">请选择正确的图片格式</span></li>
        </ul>
        <ul>
            <li class="w85r b">图片所在层 </li>
            <li>
                <asp:TextBox ID="displayOrderTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox></li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" CssClass="warning" runat="server"
                    ControlToValidate="displayOrderTextBox" ErrorMessage="请填写图片所在层" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator></li>
            <li>
                <asp:RangeValidator ID="RangeValidator2" CssClass="warning" runat="server" ControlToValidate="displayOrderTextBox"
                    ErrorMessage="请填写0－100之间的整数" Type="Integer" MinimumValue="0" MaximumValue="100"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul id="priceUl" runat="server">
            <li class="w85r b">价格 </li>
            <li>
                <asp:TextBox ID="priceTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox></li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" CssClass="warning" runat="server"
                    ControlToValidate="priceTextBox" ErrorMessage="请填写价格" Display="Dynamic" ForeColor=""></asp:RequiredFieldValidator></li>
            <li>
                <div id="priceDiv" class="slider">
                    <ul>
                    </ul>
                </div>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator1" CssClass="warning" runat="server" ControlToValidate="priceTextBox"
                    ErrorMessage="请填写1－1000000之间的整数" Type="Integer" MinimumValue="1" MaximumValue="1000000"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul id="ulDiv" runat="server">
            <li class="w85r b">使用等级 </li>
            <li>
                <asp:CheckBoxList ID="ulCheckBoxList" runat="server" RepeatDirection="Horizontal"
                    RepeatColumns="10">
                </asp:CheckBoxList>
            </li>
        </ul>
        <ul>
            <li class="w85r b">设施具体描述 </li>
            <li>
                <asp:TextBox ID="desTextBox" runat="server" Columns="70" Rows="5" TextMode="MultiLine"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="valueRequired" CssClass="warning" runat="server"
                    Enabled="false" ControlToValidate="desTextBox" ErrorMessage="请填写具体描述" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
        </ul>
        <ul id="adLevelUl" runat="server" visible="false">
            <li class="w85r b">广告牌等级 </li>
            <li>
                <asp:TextBox ID="adLevelTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" CssClass="warning" runat="server"
                    ControlToValidate="adLevelTextBox" ErrorMessage="请填写广告牌等级" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator6" CssClass="warning" runat="server" ControlToValidate="adLevelTextBox"
                    ErrorMessage="请填写1－4之间的整数" Type="Integer" MinimumValue="1" MaximumValue="4" Display="Dynamic"
                    ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul id="adOrderUl" runat="server" visible="false">
            <li class="w85r b">广告显示顺序 </li>
            <li>
                <asp:TextBox ID="adOrderTextBox" runat="server" CssClass="text" onblur="Validate()"></asp:TextBox>
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" CssClass="warning" runat="server"
                    ControlToValidate="adOrderTextBox" ErrorMessage="请填写广告显示顺序" Display="Dynamic"
                    ForeColor=""></asp:RequiredFieldValidator>
            </li>
            <li>
                <asp:RangeValidator ID="RangeValidator7" CssClass="warning" runat="server" ControlToValidate="adOrderTextBox"
                    ErrorMessage="请填写1－999之间的整数" Type="Integer" MinimumValue="1" MaximumValue="999"
                    Display="Dynamic" ForeColor=""></asp:RangeValidator>
            </li>
        </ul>
        <ul class="bb">
            <li>
                <asp:HiddenField ID="actionTypeHidden" runat="server" Value="Add" />
                <asp:HiddenField ID="idHidden" runat="server" />
                <asp:Button ID="SaveButton" runat="server" CssClass="button" Text="保存" OnClick="Save" />
            </li>
        </ul>
    </div>
    <asp:Repeater ID="annexeRepeater" runat="server" Visible="false" OnItemDataBound="Repeater_DataBound"
        OnItemCommand="Repeater_Command">
        <HeaderTemplate>
            <table class="tblist">
                <tr>
                    <th>
                        设施名称
                    </th>
                    <th>
                        设施类型
                    </th>
                    <th>
                        适用组件类型
                    </th>
                    <th>
                        适用组件等级
                    </th>
                    <th>
                        普通比赛收入
                    </th>
                    <th>
                        大型比赛收入
                    </th>
                    <th>
                        X轴位置
                    </th>
                    <th>
                        Y轴位置
                    </th>
                    <th>
                        所在层
                    </th>
                    <th>
                        价格
                    </th>
                    <th>
                    </th>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:HiddenField ID="idHidden" runat="server" />
                    <asp:Label ID="annexeNameLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="annexeTypeLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="JTypeLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="levelLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="earningsLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="raceEarningsLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="xLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="yLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="displayOrderLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="priceLabel" runat="server"></asp:Label>
                </td>
                <td>
                    <asp:LinkButton ID="EditButton" runat="server" CssClass="btnsty" CausesValidation="false"
                        CommandName="Edit" Text="修改" />
                    <asp:LinkButton ID="DeleteButton" runat="server" CssClass="btnsty cred" CausesValidation="false"
                        CommandName="Delete" Text="删除" OnClientClick="return confirm('确定删除？')" />
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>
    </form>
</body>
</html>
